--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_flandre_scarlet = General:new(extension, "hy_flandre_scarlet", "chi_k", 4, 4, General.Female)
    local death_waltz = fk.CreateSkill {
        name = "death_waltz",
    }
    death_waltz:addEffect(fk.EventPhaseStart, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(death_waltz.name) and player == target and player.phase == Player.Play
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local judge = {
                who = player,
                reason = death_waltz.name,
                pattern = ".|.|spade,club,diamond",
            }
            room:judge(judge)
            if judge.card.suit ~= Card.Heart then
                room:useVirtualCard("analeptic", nil, player, player, death_waltz.name)
            end
        end
    })
    death_waltz:addEffect(fk.Damage, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(death_waltz.name) and player == target and data.from and data.to:distanceTo(player) <= 1
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:useVirtualCard("analeptic", nil, data.from, data.from, death_waltz.name)
        end
    })
    death_waltz:addEffect(fk.Damaged, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(death_waltz.name) and player == target and data.from and data.to:distanceTo(player) <= 1
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:useVirtualCard("analeptic", nil, data.from, data.from, death_waltz.name)
        end
    })
    local entirely_destroy = fk.CreateSkill {
        name = "entirely_destroy",
    }
    entirely_destroy:addEffect(fk.EventPhaseStart, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(entirely_destroy.name) and target.phase == Player.Finish and #player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
                return e.data.card.trueName == "analeptic"
            end, Player.HistoryTurn) > 0
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local targets = {}
            for _, t in ipairs(room.alive_players) do
                if #room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
                        return e.data.card.trueName == "analeptic" and e.data.from == t
                    end, Player.HistoryTurn) > 0 then
                    table.insertIfNeed(targets, t)
                end
            end
            room:sortByAction(targets)
            for _, t in ipairs(targets) do
                if t == player then
                    local use = room:askToUseCard(t, {
                        skill_name = "slash",
                        pattern = "slash|.|.|hand",
                        prompt = "entirely_destroy_prompt_self",
                        extra_data = {
                            bypass_times = true,
                        }
                    })
                    if use then
                        use.extraUse = true
                        t:showCards(use.card)
                        use.card = Fk:cloneCard(use.card.name)
                        room:useCard(use)
                    else
                        room:loseHp(t, 1, entirely_destroy.name)
                        if t:isAlive() then
                            local slash = room:getCardsFromPileByRule("slash", 1, "discardPile")
                            if #slash > 0 then
                                room:moveCardTo(slash, Card.PlayerHand, t, fk.ReasonPrey, entirely_destroy.name, nil, true, t.id)
                            end
                        end
                    end
                else
                    local use = room:askToUseCard(t, {
                        skill_name = "slash",
                        pattern = "slash",
                        prompt = "entirely_destroy_prompt_other",
                        extra_data = {
                            bypass_times = true,
                        }
                    })
                    if use then
                        use.extraUse = true
                        room:useCard(use)
                    else
                        room:loseHp(t, 1, entirely_destroy.name)
                        if t:isAlive() then
                            local slash = room:getCardsFromPileByRule("slash", 1, "discardPile")
                            if #slash > 0 then
                                room:moveCardTo(slash, Card.PlayerHand, t, fk.ReasonPrey, entirely_destroy.name, nil, true, t.id)
                            end
                        end
                    end
                end
            end
        end,
    })
    extension:loadSkillSkels { death_waltz, entirely_destroy }
    hy_flandre_scarlet:addSkill("death_waltz")
    hy_flandre_scarlet:addSkill("entirely_destroy")
    Fk:loadTranslationTable {
        ["hy_flandre_scarlet"] = "芙兰朵露",
        ["#hy_flandre_scarlet"] = "无尽灭尽",
        ["illustrator:hy_flandre_scarlet"] = "SKISSSS",
        ["designer:hy_flandre_scarlet"] = "黑曜人形",
        ["cv:hy_flandre_scarlet"] = "",

        ["death_waltz"] = "狂曲",
        [":death_waltz"] = "出牌阶段开始时，你进行判定：若不为♥，你视为使用一张无次数限制的【酒】。在你造成或受到伤害后，若受伤角色与你距离不大于1，伤害来源视为使用一张无次数限制的【酒】。",

        ["entirely_destroy"] = "毁绝",
        [":entirely_destroy"] = "每名角色的结束阶段，所有于本回合使用过【酒】的角色选择一项：1.失去1点体力，然后从弃牌堆随机获得一张【杀】；2.使用一张【杀】。若为你，选项2改为“展示一张【杀】并视为使用之”。",
        ["entirely_destroy_prompt_self"] = "毁绝：你须展示并视为使用一张【杀】，否则你失去体力并获得【杀】",
        ["entirely_destroy_prompt_other"] = "毁绝：你须使用一张【杀】，否则你失去体力并获得【杀】",
    }
end
